package com.yhsimon.mediator.smarthouse;

/**
 * @author： YHSimon
 * @date： 2021-10-19 09:47
 */
public class TV extends Colleague {
    public TV(Mediator mediator, String name){
        super(mediator,name);
        //在创建同事对象时，将自己放入到ConcreteMediator
        mediator.register(name,this);
    }


    public void startTV() {

        System.out.println("It's time to StartTv!");

    }

    public void stopTV() {
        System.out.println("StopTV!");
    }

    public void sendMessage(int stateChange){
        //调用的中介者对象的getMessage
        this.getMediator().getMessage(stateChange,this.name);
    }
}
